Learning AppleScript

Here are some examples of AppleScript

Ref1

VoodooPad: AppleScript

Create a new page:

tell application "VoodooPad"
  tell document 1 to create page with title "new page" with contents "This is a new page."
end tell

Export to iPod:

tell application "VoodooPad"  
  -- this is the path to your document.
  open "srv:Users:gus:Desktop:astest.vdoc" as alias
  tell front document
    export to ipod
  end tell
end tell

Reading a Text file Into an AppleScript Variable

set theFile to (choose file with prompt "Select a file to read:" of type {"TEXT"})
open for access theFile
set fileContents to (read theFile)
close access theFile

Writing an AppleScript Variable to a Text File

set newFile to new file with prompt "Output file:" default name "My New File"
open for access newFile with write permission
-- if you want to overwrite an existing file use set eof of newFile to 0 first.
write "something useful" to newFile
close access newFile
Homepage
Comments

Hide Comments